#ifndef T_GLOBAL_H
#define T_GLOBAL_H

#include <QtCore>

#define T_DECLARE_PRIVATE(Class) \
class Class##Private *d_ptr; \
    Q_DECLARE_PRIVATE(Class)

#define T_DECLARE_PUBLIC(Class) \
    class Class *q_ptr; \
    Q_DECLARE_PUBLIC(Class)

#define T_INIT_QPTR(X) QObject(X), q_ptr(X)
#define T_INIT_DPTR(Class) d_ptr = new Class##Private

class T_Sleeper : public QThread
{
public:
    static void msleep(unsigned long a_msecs)
    {
        QThread::msleep(a_msecs);
    }
    static void usleep(unsigned long a_usecs)
    {
        QThread::usleep(a_usecs);
    }
};

#ifdef __GNUC__
#    define T_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y)
#else
#    define T_GCC_VERSION_AT_LEAST(x,y) 0
#endif

#ifndef box_deprecated
#if T_GCC_VERSION_AT_LEAST(3,1)
#    define T_DEPRECATED __attribute__((deprecated))
#else
#    define T_DEPRECATED
#endif
#endif


#endif // T_GLOBAL_H
